/*
 * @Date: 2023-12-18 17:55:55
 * @LastEditors: 玄绮 shijiahansi@qq.com
 * @LastEditTime: 2024-04-13 16:17:42
 * @FilePath: \client\src\forms\mainwindow\listforms\contactform\roomlistform.h
 */
#ifndef ROOMLISTFORM_H
#define ROOMLISTFORM_H

#include <QWidget>
#include <data/UserInfo.pb.h>
using namespace proto;
#include <forms/mainwindow/WindowManager.h>
#include <qobjectdefs.h>

namespace Ui {
    class RoomListForm;
}

class RoomListForm : public QWidget {
    Q_OBJECT

public:
    explicit RoomListForm(WindowManager& manager, QWidget* parent = nullptr);
    ~RoomListForm();

protected:
    void init();
    void initChatRoomList();
    void addWidget(data::ChatRoomInfo& info);

signals:
    void signalToggle();

public slots:
    void onGetRoomList(int code);

    void onItemClicked(QListWidgetItem* item);
    void onItemDoubleClicked(QListWidgetItem* item);

private:
    Ui::RoomListForm*                     ui;
    std::map<QString, std::shared_ptr<data::ChatRoomInfo>> m_chatrooms;
    WindowManager&                        manager;
};

#endif  // ROOMLISTFORM_H
